/**************************************************************************************
 * [Project]
 *       MyProgressDialog
 * [Package]
 *       com.lxd.widgets
 * [FileName]
 *       CustomProgressDialog.java
 * [Copyright]
 *       Copyright 2012 LXD All Rights Reserved.
 * [History]
 *       Version          Date              Author                        Record
 *--------------------------------------------------------------------------------------
 *       1.0.0           2012-4-27         lxd (rohsuton@gmail.com)        Create
 **************************************************************************************/
package com.jams.goodox.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.jams.goodox.R;

import java.io.Serializable;


/********************************************************************
 * [Summary]
 *       TODO 请在此处简要描述此类所实现的功能。因为这项注释主要是为了在IDE环境中生成tip帮助，务必简明扼要
 * [Remarks]
 *       TODO 请在此处详细描述类的功能、调用方法、注意事项、以及与其它类的关系.
 *******************************************************************/

public class LoadingDialog extends Dialog  implements Serializable {
	private Context context = null;
	private static LoadingDialog customProgressDialog = null;
	private static TextView tx_hint;

	private LoadingDialog(Context context){
		super(context);
		this.context = context;
	}

	public LoadingDialog(Context context, int theme) {
		super(context, theme);
	}

	public static LoadingDialog createDialog(Context context){
		try {
			customProgressDialog = new LoadingDialog(context, R.style.loadingDialog);
			customProgressDialog.setContentView(R.layout.loading_activity_dialog);
			customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
			customProgressDialog.setCanceledOnTouchOutside(false);
			tx_hint=(TextView)customProgressDialog.findViewById(R.id.tx_hint);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return customProgressDialog;
	}

	@Override
	public void onWindowFocusChanged(boolean hasFocus){
		if (customProgressDialog == null){
			return;
		}
	}

	/**
	 *
	 * [Summary]
	 *       setTitile 标题
	 * @param strTitle
	 * @return
	 *
	 */
	public LoadingDialog setTitile(String strTitle){
		tx_hint.setText(strTitle);
		tx_hint.setVisibility(View.VISIBLE);
		return customProgressDialog;
	}

}
